/**
 * opcodetables.h
 * Contains all of the tables pertaining to opcode data.
 *
 * @author  Philippe Johnson
 */

#ifndef __OPCODETABLES_H__
#define __OPCODETABLES_H__

#include "opcodes.h"

/* For assert() later */
#define OPCODE_TABLESIZE    (256 * 4)

#ifdef OPCODEDEBUG

extern u8* opMneumonics[256];

#endif /* OPDEBUG */

/* Opcode function lookup table
   Indexing into this table functions as follows:
   The opcode essentially refers to a block of four potential
   functions. From there, one of the four functions is selected
   according to the M and X flags. 

   The scheme takes the byte-long opcode (OP), shifts it over by 
   two bits and inserts the M and X values respectively
   into the low-order bits of the index.

   index = (OP << 2) | MX
*/
extern opcodeFunc opcodeFunction[OPCODE_TABLESIZE];

/* Cycle tables-- how many cycles each instruction takes 
   under the different m/x flag configurations           */
extern u8 opCyclesMX[];
extern u8 opCyclesmX[];
extern u8 opCyclesMx[];
extern u8 opCyclesmx[];

/* Opcode size tables- The number of bytes per opcode under all m/x flag
   configurations */
extern u8 opSizeMX[];
extern u8 opSizemX[];
extern u8 opSizeMx[];
extern u8 opSizemx[];

#endif /* __OPCODETABLES_H__ */
